Skip to content

refactor(@angular/cli): transition update command to use PackageManager abstraction#33364

Open
clydin wants to merge 3 commits into
angular:mainfrom
clydin:refactor-update-package-manager-abstraction
Open

refactor(@angular/cli): transition update command to use PackageManager abstraction#33364
clydin wants to merge 3 commits into
angular:mainfrom
clydin:refactor-update-package-manager-abstraction

Conversation

@clydin

@clydin clydin commented Jun 11, 2026

Copy link
Copy Markdown
Member

Transition the update command's version resolver to utilize the registry methods from the PackageManager abstraction instead of directly querying the registry via pacote.

This introduces a cached RegistryClient wrapper that retrieves package metadata and manifests on-demand. Update resolution helper functions are updated to be asynchronous to support the lazy-loading of registry documents.

Fixes #33119 (Honors minimum-release-age and supply-chain policies)
Fixes #27163 (Enforces project-scoped .npmrc / .yarnrc registry settings)
Fixes #26505 (Yarn Plug'n'Play compatibility)
Fixes #28834 (Gracefully handles private/unpublished packages via local package info)

@clydin clydin force-pushed the refactor-update-package-manager-abstraction branch from 6cdfcbc to 93c2ef7 Compare June 15, 2026 12:35
@clydin clydin marked this pull request as ready for review June 15, 2026 13:15

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the update resolution mechanism in the Angular CLI to use a new RegistryClient class for caching package metadata and manifests, while also moving several dependencies (like pacote, ini, and @yarnpkg/lockfile) to the root package.json. The review feedback suggests improving the robustness of the RegistryClient cache by removing rejected promises to prevent cache poisoning, and optimizing performance by parallelizing sequential async operations using Promise.all when building package info and printing update usage messages.

Comment thread packages/angular/cli/src/commands/update/update-resolver.ts
Comment thread packages/angular/cli/src/commands/update/update-resolver.ts
Comment thread packages/angular/cli/src/commands/update/update-resolver.ts Outdated
Comment thread packages/angular/cli/src/commands/update/update-resolver.ts Outdated
@clydin clydin force-pushed the refactor-update-package-manager-abstraction branch from a972cab to dbc0c36 Compare June 15, 2026 13:57
clydin added 3 commits June 15, 2026 10:01
…er abstraction

Transition the update command's version resolver to utilize the registry methods from the
PackageManager abstraction instead of directly querying the registry via pacote.

This introduces a cached RegistryClient wrapper that retrieves package metadata and manifests
on-demand. Update resolution helper functions are updated to be asynchronous to support the
lazy-loading of registry documents.
…y authentication

Configure always-auth in the written .npmrc and .yarnrc test profiles within
createNpmConfigForAuthentication.

By default, Yarn Classic (v1) does not send the Authorization header on GET requests (such as
retrieving manifest metadata via yarn info) unless always-auth is enabled. When ng update uses the
PackageManager abstraction under Yarn Classic v1, this ensures the necessary authorization headers
are sent to secure registry endpoints.
When running scripts via Yarn Classic (such as yarn ng update), Yarn automatically injects
npm_config_registry=https://registry.yarnpkg.com into the child process environment.

When the PackageManager abstraction spawns child CLI subprocesses (such as yarn info), those child
processes inherit the injected registry environment variable. Because environment variables take
highest precedence, this previously caused spawned subprocesses to ignore local .yarnrc files and
query the public CDN mirror.

Strip npm_config_registry and NPM_CONFIG_REGISTRY from the child process environment when running
under Yarn so that spawned subprocesses correctly respect local repository registry settings.
@clydin clydin force-pushed the refactor-update-package-manager-abstraction branch 2 times, most recently from dbc0c36 to 9e77dfc Compare June 15, 2026 14:02
@clydin clydin added the target: minor This PR is targeted for the next minor release label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/cli target: minor This PR is targeted for the next minor release

Projects

None yet

1 participant